<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tcl_GetCwd manual page - Tcl Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tcl C API</a> <small>&gt;</small> GetCwd</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="GetCwd.htm#M2" NAME="L357">NAME</A>
<DL><DD>Tcl_GetCwd, Tcl_Chdir &mdash; manipulate the current working directory</DD></DL>
<DD><A HREF="GetCwd.htm#M3" NAME="L358">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tcl.h&gt;</B>
<DD>char *
<DD><B>Tcl_GetCwd</B>(<I>interp</I>, <I>bufferPtr</I>)
<DD>int
<DD><B>Tcl_Chdir</B>(<I>path</I>)
</DL>
<DD><A HREF="GetCwd.htm#M4" NAME="L359">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="GetCwd.htm#M5" NAME="L360">DESCRIPTION</A>
<DD><A HREF="GetCwd.htm#M6" NAME="L361">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Tcl_GetCwd, Tcl_Chdir &mdash; manipulate the current working directory
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tcl.h&gt;</B><BR>
char *<BR>
<B>Tcl_GetCwd</B>(<I>interp</I>, <I>bufferPtr</I>)<BR>
int<BR>
<B>Tcl_Chdir</B>(<I>path</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter in which to report an error, if any.
<P><DT><A HREF="../TclLib/DString.htm">Tcl_DString</A> <B>*bufferPtr</B> (in/out)<DD>
This dynamic string is used to store the current working directory.
At the time of the call it should be uninitialized or free.  The
caller must eventually call <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree</A></B> to free up
anything stored here.
<P><DT>char <B>*path</B> (in)<DD>
File path in UTF-8 format.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
These procedures may be used to manipulate the current working
directory for the application.  They provide C-level access to
the same functionality as the Tcl <B><A HREF="../TclCmd/pwd.htm">pwd</A></B> command.
<P>
<B>Tcl_GetCwd</B> returns a pointer to a string specifying the current
directory, or NULL if the current directory could not be determined.
If NULL is returned, an error message is left in the <I>interp</I>'s result.
Storage for the result string is allocated in bufferPtr; the caller
must call <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree()</A></B> when the result is no longer needed.
The format of the path is UTF-8.
<P>
<B>Tcl_Chdir</B> changes the applications current working directory to
the value specified in <I>path</I>.  The format of the passed in string
must be UTF-8.  The function returns -1 on error or 0 on success.

<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/P.htm#pwd">pwd</A>
<div class="copy">Copyright &copy; 1998-1999 Scriptics Corporation
</div>
</BODY></HTML>
